import numpy as np

# 对于有顺序的数组快捷方式
Z = np.arange(1, 10).reshape(3, 3)
Z = np.pad(Z, ((1, 1), (1, 1)), 'constant', constant_values=(0, 0))
print(Z)
# 缩进格式有错误时，Alt+Shift+Enter

# 对于无顺序的数组
M = np.array([[10, 34, 54, 23],\
              [31, 87, 53, 68],\
              [98, 49, 25, 11],\
              [84, 32, 67, 88]])




M = np.pad(M, ((1, 1), (1, 1)), 'constant', constant_values=(0, 0))
print(M)
